#!/bin/bash
#
# config ceph domain using by read/write objs from other cephs though TLS HTTP 

source cluster_ip.conf

i=1
for node in ${CEPH_IP[@]}
do
    IP_in_hosts=$(grep peer0.org${i}.demo.com /etc/hosts | awk '{print $1}')
    if [ "$IP_in_hosts" == "" ]; then
        echo "$node peer0.org${i}.demo.com" | sudo tee -a /etc/hosts
    elif [ $IP_in_hosts != $node ]; then
        sudo sed -i "s/.*peer0.org${i}.demo.com/$node peer0.org${i}.demo.com/g" /etc/hosts
    fi
    let i=$i+1
done
